<div style="min-width:850px;">
  <nz-breadcrumb class="breadcrumb-pos">
    <i nz-icon type="link" theme="outline" style="color:#1890FF;padding-right:4px"></i>
    <nz-breadcrumb-item>
      租户管理
    </nz-breadcrumb-item>
  </nz-breadcrumb>
  <div nz-row [nzGutter]="16" style="border-bottom: 1px solid #ccc;margin-bottom: 8px;">
    <div nz-col [nzSpan]="7">
      <nz-form-item nzFlex>
        <nz-form-label>公司名称</nz-form-label>
        <nz-form-control>
          <input nz-input [(ngModel)]="companyName">
        </nz-form-control>
      </nz-form-item>
    </div>
    <div nz-col [nzSpan]="7">
      <nz-form-item nzFlex>
        <nz-form-label>负责人</nz-form-label>
        <nz-form-control>
          <input nz-input [(ngModel)]="name">
        </nz-form-control>
      </nz-form-item>
    </div>
    <div nz-col [nzSpan]="8">
      <nz-form-item nzFlex>
        <nz-form-label>负责人手机号</nz-form-label>
        <nz-form-control>
          <input nz-input [(ngModel)]="mobile">
        </nz-form-control>
        <button nz-button [nzType]="'primary'" [nzLoading]="btn_loading" style="margin:3px 0 0 20px;" (click)="getTenantlist()">查询</button>
      </nz-form-item>
    </div>
  </div>

  <div class="add_btn">
    <button nz-button nzType="primary" routerLink="/main/addtenant"><i nz-icon type="plus"></i>添加</button>
    <button nz-button style="float:right" (click)="exportOut()">导出Excel</button>
  </div>
  <nz-table #basicTable [nzData]="tenantlist" [nzLoading]="loading" [nzShowPagination]="false" [nzBordered]="true">
    <thead>
      <tr>
        <th>公司名称</th>
        <th>公司电话</th>
        <th>负责人</th>
        <th>负责人手机号</th>
        <th>当前设备数量</th>
        <th>地址</th>
        <th>详细地址</th>
        <th>操作</th>
      </tr>
    </thead>
    <tbody>
      <tr *ngFor="let data of tenantlist">
        <td>{{data.companyName}}</td>
        <td>{{data.tel}}</td>
        <td>{{data.name}}</td>
        <td>{{data.mobile}}</td>
        <td>{{data.useSignSum}}</td>
        <td>
          {{data.provinceId && data.provinceId !==-1?province[data.provinceId].name:""}}{{data.cityId && data.cityId !==-1?city[data.cityId].name:""}}{{data.districtId && data.districtId !==-1?district[data.districtId].name:""}}
        </td>
        <td>{{data.address}}</td>
        <td class="td_btn">
          <a style="margin-right:12px;" routerLink="/main/edittenant/{{data.id}}">编辑</a>
          <a style="color:#78B259;margin-right:12px;" routerLink="/main/tenantinfo/{{data.id}}">详情</a>
          <nz-popconfirm [nzTitle]="'确定要删除么?'" (nzOnConfirm)="delete(data.id)">
            <a nz-popconfirm style="color:#E48675">删除</a>
          </nz-popconfirm>
        </td>
      </tr>
    </tbody>
  </nz-table>
  <nz-pagination style="float:right;margin-top:12px" [nzPageIndex]="PageIndex" [nzPageSize]="PageSize"
    [nzTotal]="PageTotal" (nzPageIndexChange)="PageIndexChange($event)" [nzHideOnSinglePage]="true"
    [nzShowTotal]="totalTemplate"></nz-pagination>
  <ng-template #totalTemplate let-total>
    共 {{total}} 条数据
  </ng-template>
</div>